package cn.itcast.structured

import org.apache.spark.sql.{DataFrame, SparkSession}

object KafkaSource {
  val spark = SparkSession.builder()
    .appName("hdfs_source")
    .master("local[6]")
    .getOrCreate()

  val source: DataFrame = spark.readStream
    .format("kafka")
    .option("kafka.bootstrap.servers", "node1.itcast.cn:9092,node2.itcast.cn:9092,node3.itcast.cn:9092")
    .option("subscribe", "streaming-test")
    .option("startingOffsets", "earliest")
    .load()
}
